<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta name="format-detection" content="telephone=no"/>
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
    <script src="/js/resize.js"></script>
    <% include baiduTJ.html %>
    <link rel="stylesheet" href="/css/myreset.min.css">
    <link rel="stylesheet" href="/css/animate.css">
    <link rel="stylesheet" href="/share/css/index.css">
    <title><%= title %></title>
</head>
<body>

<div class="outer">
    <div class="container" id="container">
        <div class="buycart animated fadeInRightBig  <%= 'b-' + buycart %>"></div>
        <div class="rule"></div>

        <div class="user-info">
            <div>你的好友 <img src="<%= userinfo.headimgurl %>" alt=""> <span><%= userinfo.nickname %></span> 邀你来点赞!</div>
            <div>(温馨提示:每个人只能赞一次哦!)</div>
        </div>

        <div class="z-1 zan" data-id=1 data-zan="<%= zan['1'].num %>" data-all="<%= zan['1'].all %>">
            <div class="num"><span><%= zan['1'].num %></span></div>
            <div class="info"><span><%= zan['1'].num %>/<%= zan['1'].all %></span></div>
        </div>
        <div class="z-2 zan" data-id=2 data-zan="<%= zan['2'].num %>" data-all="<%= zan['2'].all %>">
            <div class="num"><span><%= zan['2'].num %></span></div>
            <div class="info"><span><%= zan['2'].num %>/<%= zan['2'].all %></span></div>
        </div>
        <div class="z-3 zan" data-id=3 data-zan="<%= zan['3'].num %>" data-all="<%= zan['3'].all %>">
            <div class="num"><span><%= zan['3'].num %></span></div>
            <div class="info"><span><%= zan['3'].num %>/<%= zan['3'].all %></span></div>
        </div>
        <div class="next"></div>
    </div>
</div>

<script src="/js/zepto.1.1.6.min.js"></script>
<script src="/js/base.2.0.js"></script>
<script src="/js/jweixin-1.0.0.js"></script>
<script src="/js/weixin.js"></script>
<% include wxshare.html %>
<% include music.html %>
<script>
    $(function () {
        var dh = $(window).height();
        var ch = $("#container").height();
        if (ch > dh) {
            var ro = dh / ch;
            $(".outer").css({
                "font-size": ro + "rem"
            });
        }
    })
</script>

<script>
    var clickFlag = false;
    $(".zan").on("tap", function () {
        var dto = {
            openid: getQueryString("openid"),
            pid: $(this).data("id"),
            oid: getQueryString("oid")
        }

        var self = this;

        if (clickFlag) return;
        clickFlag = true;

        $.ajax({
            url: "/index/share/addzan",
            type: "POST",
            dataType: "json",
            data: dto,
            timeout: 5000,
            success: function (data) {
                if (data.errno)
                    alert(data.errmsg)
                else {
                    var zan = $(self).data("zan");
                    var all = $(self).data("all");
                    zan = parseInt(zan) + 1;
                    $(self).find("span").eq(0).html(zan);
                    $(self).find("span").eq(1).html(zan + "/" + all);
                    alert("点赞成功");
                    playZan();
                }
                clickFlag = false;
            },
            error: function () {
                clickFlag = false;
                alert("网络错误");
            }
        })
    });


    $(".rule").on("tap", function () {
        playBtn(function () {
            window.location.href = "/index/rule?openid=" + getQueryString("oid");
        });
    });

    //我也要玩
    $(".next").on("tap", function () {
        playBtn(function () {
            window.location.href = "/index/home?openid=" + getQueryString("oid");
        });
    });
</script>
</body>
</html>